package com.yfl.controller;

import com.yfl.domain.Banner;
import com.yfl.model.Result;
import com.yfl.service.BannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "轮播图管理")
public class BannerController {

   @DubboReference
   private BannerService bannerService;



    @GetMapping("test")
    @ApiOperation(value = "测试轮播图的接口")
    public Banner test() {
        return new Banner();
    }

    /**
     * 因为前后端数据交互存在网络延迟
     * 规范 数据包越小越好
     * 全局搜索 ctrl+shift+r
     *
     * @return
     */
    @GetMapping("getBanner")
    @ApiOperation(value = "获取轮播图的接口")
    public Result getBanner() {
        List<String> paths = bannerService.selectBanner();
        return Result.success(200, "ok", paths);
    }

}
